home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Development Platforms / Macintosh Common Lisp Related / interfaces / TextEdit.lisp < prev    next >
Encoding:
Text File  |  1993-09-16  |  17.6 KB  |  521 lines  |  [TEXT/CCL2]

  1. (in-package :traps)
  2. ;
  3. ; File:  TextEdit.p
  4. ;
  5. ; Copyright: © 1983-1993 by Apple Computer, Inc.
  6. ;    All rights reserved.
  7. ;
  8. ; Version: System 7.1 for ETO #11
  9. ; Created: Tuesday, March 30, 1993 18:00
  10. ;
  11. ; Adapted for MCL 2.0 by Gilles Serasset, GETA-IMAG, France
  12. ;
  13.  
  14. ;$IFC UNDEFINED UsingIncludes
  15. ;$SETC UsingIncludes := 0
  16. ;$ENDC}
  17. ;
  18. ;$IFC NOT UsingIncludes
  19. ; UNIT TextEdit;
  20. ; INTERFACE
  21. ;$ENDC
  22. ;
  23. ;$IFC UNDEFINED UsingTextEdit
  24. ;$SETC UsingTextEdit := 1
  25. ;
  26. ;$I+
  27. ;$SETC TextEditIncludes := UsingIncludes
  28. ;$SETC UsingIncludes := 1
  29. ;$IFC UNDEFINED UsingQuickdraw
  30. ;$I $$Shell(PInterfaces)Quickdraw.p
  31.  
  32. (require-interface 'QUICKDRAW)  ; $I $$Shell(PInterfaces)Quickdraw.p
  33.  
  34. ;$ENDC
  35. ;$SETC UsingIncludes := TextEditIncludes
  36.  
  37.  
  38. ;{ Justification (word alignment) styles }
  39.  
  40. (defconstant $teJustLeft 0);
  41. (defconstant $teJustCenter 1);
  42. (defconstant $teJustRight -1);
  43. (defconstant $teForceLeft -2);
  44.  
  45. ;{ new names for the Justification (word alignment) styles }
  46. (defconstant $teFlushDefault 0);      ;{flush according to the line direction }
  47. (defconstant $teCenter 1);       ;{center justify (word alignment) }
  48. (defconstant $teFlushRight -1);      ;{flush right for all scripts }
  49. (defconstant $teFlushLeft -2);      ;{flush left for all scripts }
  50.  
  51. ;{ Set/Replace style modes }
  52. (defconstant $fontBit 0);       ;{set font}
  53. (defconstant $faceBit 1);       ;{set face}
  54. (defconstant $sizeBit 2);       ;{set size}
  55. (defconstant $clrBit 3);        ;{set color}
  56. (defconstant $addSizeBit 4);       ;{add size mode}
  57. (defconstant $toggleBit 5);       ;{set faces in toggle mode}
  58. (defconstant $toglBit 5);       ;{ obsolete.  use toggleBit }
  59.  
  60. ;{ TESetStyle/TEContinuousStyle modes }
  61. (defconstant $doFont 1);        ;{ set font (family) number}
  62. (defconstant $doFace 2);        ;{set character style}
  63. (defconstant $doSize 4);        ;{set type size}
  64. (defconstant $doColor 8);       ;{set color}
  65. (defconstant $doAll 15);        ;{set all attributes}
  66. (defconstant $addSize 16);       ;{adjust type size}
  67. (defconstant $doToggle 32);       ;{toggle mode for TESetStyle & TEContinuousStyle}
  68.  
  69. ;{ offsets into TEDispatchRec }
  70. (defconstant $EOLHook 0);       ;{[ProcPtr] TEEOLHook}
  71. (defconstant $DRAWHook 4);       ;{[ProcPtr] TEWidthHook}
  72. (defconstant $WIDTHHook 8);       ;{[ProcPtr] TEDrawHook}
  73. (defconstant $HITTESTHook 12);      ;{[ProcPtr] TEHitTestHook}
  74. (defconstant $nWIDTHHook 24);      ;{[ProcPtr] nTEWidthHook}
  75. (defconstant $TextWidthHook 28);      ;{[ProcPtr] TETextWidthHook}
  76.  
  77. ;{ selectors for TECustomHook }
  78. (defconstant $intEOLHook 0);       ;{TEIntHook value}
  79. (defconstant $intDrawHook 1);      ;{TEIntHook value}
  80. (defconstant $intWidthHook 2);      ;{TEIntHook value}
  81. (defconstant $intHitTestHook 3);      ;{TEIntHook value}
  82. (defconstant $intNWidthHook 6);      ;{TEIntHook value for new version of WidthHook}
  83. (defconstant $intTextWidthHook 7);     ;{TEIntHook value for new TextWidthHook}
  84.  
  85. ;{ feature or bit definitions for TEFeatureFlag }
  86. (defconstant $teFAutoScroll 0);      ;{00000001b}
  87. (defconstant $teFAutoScr 0);       ;{00000001b  obsolete. use teFAutoScroll}
  88. (defconstant $teFTextBuffering 1);     ;{00000010b}
  89. (defconstant $teFOutlineHilite 2);     ;{00000100b}
  90. (defconstant $teFInlineInput 3);      ;{00001000b  obsolete}
  91. (defconstant $teFUseTextServices 4);     ;{00010000b  obsolete}
  92.  
  93. ;{ action for the new "bit (un)set" interface, TEFeatureFlag }
  94. (defconstant $teBitClear 0);
  95. (defconstant $teBitSet 1);       ;{set the selector bit}
  96. (defconstant $teBitTest -1);       ;{no change; just return the current setting}
  97.  
  98. ;{constants for identifying the routine that called FindWord }
  99. (defconstant $teWordSelect 4);      ;{clickExpand to select word}
  100. (defconstant $teWordDrag 8);       ;{clickExpand to drag new word}
  101. (defconstant $teFromFind 12);      ;{FindLine called it ($0C)}
  102. (defconstant $teFromRecal 16);      ;{RecalLines called it ($10)      obsolete}
  103.  
  104. ;{constants for identifying DoText selectors }
  105. (defconstant $teFind 0);           ;{DoText called for searching}
  106. (defconstant $teHighlight 1);          ;{DoText called for highlighting}
  107. (defconstant $teDraw -1);           ;{DoText called for drawing text}
  108. (defconstant $teCaret -2);           ;{DoText called for drawing the caret}
  109.  
  110.  
  111. (def-mactype :teptr (find-mactype :pointer))
  112. (def-mactype :tehandle (find-mactype :handle))
  113.  
  114. (DEFRECORD (TEREC :HANDLE) 
  115.   (destRect :RECT)
  116.   (viewRect :RECT)
  117.   (selRect :RECT)
  118.   (lineHeight :SIGNED-INTEGER)
  119.   (fontAscent :SIGNED-INTEGER)
  120.   (selPoint :POINT)
  121.   (selStart :SIGNED-INTEGER)
  122.   (selEnd :SIGNED-INTEGER)
  123.   (active :SIGNED-INTEGER)
  124.   (wordBreak :POINTER)
  125.   (clikLoop :POINTER)
  126.   (clickTime :SIGNED-LONG)
  127.   (clickLoc :SIGNED-INTEGER)
  128.   (caretTime :SIGNED-LONG)
  129.   (caretState :SIGNED-INTEGER)
  130.   (just :SIGNED-INTEGER)
  131.   (teLength :SIGNED-INTEGER)
  132.   (hText :HANDLE)
  133. ;{ recalBack: INTEGER;  }
  134. ;{ recalLines: INTEGER; }
  135.   (hDispatchRec :signed-long)
  136.   (clikStuff :SIGNED-INTEGER)
  137.   (crOnly :SIGNED-INTEGER)
  138.   (txFont :SIGNED-INTEGER)
  139.   (txFace :UNSIGNED-BYTE)
  140.   (txMode :SIGNED-INTEGER)
  141.   (txSize :SIGNED-INTEGER)
  142.   (inPort (:POINTER GRAFPORT))
  143.   (highHook :POINTER)
  144.   (caretHook :POINTER)
  145.   (nLines :SIGNED-INTEGER)
  146.   (lineStarts (:ARRAY :SIGNED-INTEGER 16001)))
  147.  
  148.  
  149. (def-mactype :CharsPtr (find-mactype :pointer))
  150. (def-mactype :CharsHandle (find-mactype :handle))
  151.  
  152. (defrecord (Chars :handle) (array (array :character 32001)))
  153.  
  154. (defrecord StyleRun 
  155.    (startChar :signed-integer)  ; starting character position
  156.    (styleIndex :signed-integer) ; index in style table
  157.    )
  158.  
  159. (DEFRECORD STELEMENT
  160.   (STCOUNT :SIGNED-INTEGER)
  161.   (STHEIGHT :SIGNED-INTEGER)
  162.   (STASCENT :SIGNED-INTEGER)
  163.   (STFONT :SIGNED-INTEGER)
  164.   (STFACE :UNSIGNED-BYTE)
  165.   (STSIZE :SIGNED-INTEGER)
  166.   (STCOLOR :RGBCOLOR))
  167.  
  168. (def-mactype :stptr (find-mactype :pointer))
  169. (def-mactype :sthandle (find-mactype :handle))
  170.  
  171. (defrecord (TEStyleTable :handle) (array (array :stelement 1777)))
  172.  
  173. (defrecord LHElement 
  174.    (lhHeight :signed-integer)   ; maximum height in line
  175.    (lhAscent :signed-integer)   ; maximum ascent in line
  176.    )
  177.  
  178. (def-mactype :lhptr (find-mactype :pointer))
  179. (def-mactype :lhhandle (find-mactype :handle))
  180.  
  181. (defrecord (LHTable :handle) (array (array :lhelement 8001)))
  182.  
  183. (DEFRECORD SCRPSTELEMENT
  184.   (SCRPSTARTCHAR :SIGNED-LONG)
  185.   (SCRPHEIGHT :SIGNED-INTEGER)
  186.   (SCRPASCENT :SIGNED-INTEGER)
  187.   (SCRPFONT :SIGNED-INTEGER)
  188.   (SCRPFACE :UNSIGNED-BYTE)
  189.   (SCRPSIZE :SIGNED-INTEGER)
  190.   (SCRPCOLOR :RGBCOLOR))
  191.  
  192.  
  193. (defrecord ScrpSTTable (array (array :scrpstelement 1601)))
  194.  
  195. (def-mactype :stscrpptr (find-mactype :pointer))
  196. (def-mactype :stscrphandle (find-mactype :handle))
  197. (defrecord (StScrpRec :handle) 
  198.    (scrpNStyles :signed-integer); number of styles in scrap
  199.    (scrpStyleTab :scrpsttable)  ; table of styles for scrap
  200.    )
  201.  
  202. (def-mactype :nullstptr (find-mactype :pointer))
  203. (def-mactype :nullsthandle (find-mactype :handle))
  204. (defrecord (NullStRec :handle) 
  205.    (teReserved :signed-long)    ; reserved for future expansion
  206.    (nullScrap (:handle :stscrprec)); handle to scrap style table
  207.    )
  208.  
  209. (def-mactype :testyleptr (find-mactype :pointer))
  210. (def-mactype :testylehandle (find-mactype :handle))
  211. (defrecord (TEStyleRec :handle) 
  212.    (nRuns :signed-integer)      ; number of style runs
  213.    (nStyles :signed-integer)    ; size of style table
  214.    (styleTab (:handle :testyletable)); handle to style table
  215.    (lhTab (:handle :lhtable))   ; handle to line-height table
  216.    (teRefCon :signed-long)      ; reserved for application use
  217.    (nullStyle (:handle :nullstrec)); Handle to style set at null selection
  218.    (runs (:array :stylerun 8001)); ARRAY [0..8000] OF StyleRun
  219.    )
  220.  
  221. (def-mactype :textstyleptr (find-mactype :pointer))
  222. (def-mactype :textstylehandle (find-mactype :handle))
  223. (DEFRECORD (TEXTSTYLE :HANDLE)
  224.   (TSFONT :SIGNED-INTEGER)
  225.   (TSFACE :UNSIGNED-BYTE)
  226.   (TSSIZE :SIGNED-INTEGER)
  227.   (TSCOLOR :RGBCOLOR))
  228.  
  229. (def-mactype :teinthook (find-mactype :signed-integer))
  230.  
  231.  
  232. (deftrap _teinit nil
  233.    nil
  234.    (:stack-trap #xA9CC))
  235.  
  236. (deftrap _tenew ((destrect :rect) (viewrect :rect))
  237.    (:stack (:handle :terec))
  238.    (:stack-trap #xA9D2))
  239.  
  240. (deftrap _tedispose ((hte (:handle :terec)))
  241.    nil
  242.    (:stack-trap #xA9CD))
  243.  
  244. (deftrap _tesettext ((text :pointer) (length :signed-long) (hte (:handle :terec)))
  245.    nil
  246.    (:stack-trap #xA9CF))
  247.  
  248. (deftrap _tegettext ((hte (:handle :terec)))
  249.    (:stack (:handle :chars))
  250.    (:stack-trap #xA9CB))
  251.  
  252. (deftrap _teidle ((hte (:handle :terec)))
  253.    nil
  254.    (:stack-trap #xA9DA))
  255.  
  256. (deftrap _tesetselect ((selstart :signed-long) (selend :signed-long) (hte (:handle :terec)))
  257.    nil
  258.    (:stack-trap #xA9D1))
  259.  
  260. (deftrap _teactivate ((hte (:handle :terec)))
  261.    nil
  262.    (:stack-trap #xA9D8))
  263.  
  264. (deftrap _tedeactivate ((hte (:handle :terec)))
  265.    nil
  266.    (:stack-trap #xA9D9))
  267.  
  268. (deftrap _tekey ((key :character) (hte (:handle :terec)))
  269.    nil
  270.    (:stack-trap #xA9DC))
  271.  
  272. (deftrap _tecut ((hte (:handle :terec)))
  273.    nil
  274.    (:stack-trap #xA9D6))
  275.  
  276. (deftrap _tecopy ((hte (:handle :terec)))
  277.    nil
  278.    (:stack-trap #xA9D5))
  279.  
  280. (deftrap _tepaste ((hte (:handle :terec)))
  281.    nil
  282.    (:stack-trap #xA9DB))
  283.  
  284. (deftrap _tedelete ((hte (:handle :terec)))
  285.    nil
  286.    (:stack-trap #xA9D7))
  287.  
  288. (deftrap _teinsert ((text :pointer) (length :signed-long) (hte (:handle :terec)))
  289.    nil
  290.    (:stack-trap #xA9DE))
  291.  
  292. (deftrap _tesetalignment ((just :signed-integer) (hte (:handle :terec)))
  293.    nil
  294.    (:stack-trap #xA9DF))
  295.  
  296. (deftrap _tesetjust ((just :signed-integer) (hte (:handle :terec)))
  297.    nil
  298.    (:stack-trap #xA9DF))
  299.  
  300. (deftrap _teupdate ((rupdate :rect) (hte (:handle :terec)))
  301.    nil
  302.    (:stack-trap #xA9D3))
  303.  
  304. (deftrap _tetextbox ((text :pointer) (length :signed-long) (box :rect) (just :signed-integer))
  305.    nil
  306.    (:stack-trap #xA9CE))
  307.  
  308. (deftrap _TextBox ((text :pointer) (length :signed-long) (box :rect) (just :signed-integer))
  309.    nil
  310.    (:stack-trap #xA9CE))
  311.  
  312. (deftrap _tescroll ((dh :signed-integer) (dv :signed-integer) (hte (:handle :terec)))
  313.    nil
  314.    (:stack-trap #xA9DD))
  315.  
  316. (deftrap _teselview ((hte (:handle :terec)))
  317.    nil
  318.    (:stack-trap #xA811))
  319.  
  320. (deftrap _tepinscroll ((dh :signed-integer) (dv :signed-integer) (hte (:handle :terec)))
  321.    nil
  322.    (:stack-trap #xA812))
  323.  
  324. (deftrap _teautoview ((fauto :boolean) (hte (:handle :terec)))
  325.    nil
  326.    (:stack-trap #xA813))
  327.  
  328. (deftrap _tescraphandle nil
  329.    (:no-trap :handle)
  330.    (:no-trap (%get-signed-long (%int-to-ptr 2740))))
  331.  
  332. (deftrap _tecaltext ((hte (:handle :terec)))
  333.    nil
  334.    (:stack-trap #xA9D0))
  335.  
  336. (deftrap _tegetoffset ((pt :point) (hte (:handle :terec)))
  337.    (:stack :signed-integer)
  338.    (:stack-trap #xA83C))
  339.  
  340. (deftrap _tegetpoint ((offset :signed-integer) (hte (:handle :terec)))
  341.    (:stack :point)
  342.    (:stack-trap #xA83D offset hte (8 :signed-integer)))
  343.  
  344. (deftrap _teclick ((pt :point) (fextend :boolean) (h (:handle :terec)))
  345.    nil
  346.    (:stack-trap #xA9D4))
  347.  
  348. (deftrap _testylenew ((destrect :rect) (viewrect :rect))
  349.    (:stack (:handle :terec))
  350.    (:stack-trap #xA83E))
  351.  
  352. (deftrap _testylnew ((destrect :rect) (viewrect :rect))
  353.    (:stack (:handle :terec))
  354.    (:stack-trap #xA83E))
  355.  
  356. (deftrap _SetStylHandle ((thehandle (:handle :testylerec)) (hte (:handle :terec)))
  357.    nil
  358.    (:stack-trap #xA83D thehandle hte (5 :signed-integer)))
  359.  
  360. (deftrap _SetStyleHandle ((thehandle (:handle :testylerec)) (hte (:handle :terec)))
  361.    nil
  362.    (:stack-trap #xA83D thehandle hte (5 :signed-integer)))
  363.  
  364. (deftrap _tesetstylehandle ((thehandle (:handle :testylerec)) (hte (:handle :terec)))
  365.    nil
  366.    (:stack-trap #xA83D thehandle hte (5 :signed-integer)))
  367.  
  368. (deftrap _GetStylHandle ((hte (:handle :terec)))
  369.    (:stack (:handle :testylerec))
  370.    (:stack-trap #xA83D hte (4 :signed-integer)))
  371.  
  372. (deftrap _GetStyleHandle ((hte (:handle :terec)))
  373.    (:stack (:handle :testylerec))
  374.    (:stack-trap #xA83D hte (4 :signed-integer)))
  375.  
  376. (deftrap _TEGetStyleHandle ((hte (:handle :terec)))
  377.    (:stack (:handle :testylerec))
  378.    (:stack-trap #xA83D hte (4 :signed-integer)))
  379.  
  380.  
  381. (deftrap _tegetstyle ((offset :signed-integer) (thestyle (:pointer :textstyle)) (lineheight (:pointer :signed-integer)) (fontascent (:pointer :signed-integer)) (hte (:handle :terec)))
  382.    nil
  383.    (:stack-trap #xA83D offset thestyle lineheight fontascent hte (3 :signed-integer)))
  384.  
  385. (deftrap _TEStylPaste ((hte (:handle :terec)))
  386.    nil
  387.    (:stack-trap #xA83D hte (0 :signed-integer)))
  388.  
  389. (deftrap _TEStylePaste ((hte (:handle :terec)))
  390.    nil
  391.    (:stack-trap #xA83D hte (0 :signed-integer)))
  392.  
  393. (deftrap _tesetstyle ((mode :signed-integer) (newstyle :textstyle) (redraw :boolean) (hte (:handle :terec)))
  394.    nil
  395.    (:stack-trap #xA83D mode newstyle redraw hte (1 :signed-integer)))
  396.  
  397. (deftrap _tereplacestyle ((mode :signed-integer) (oldstyle :textstyle) (newstyle :textstyle) (redraw :boolean) (hte (:handle :terec)))
  398.    nil
  399.    (:stack-trap #xA83D mode oldstyle newstyle redraw hte (2 :signed-integer)))
  400.  
  401. (deftrap _tegetstylescraphandle ((hte (:handle :terec)))
  402.    (:stack (:handle :stscrprec))
  403.    (:stack-trap #xA83D hte (6 :signed-integer)))
  404.  
  405. (deftrap _GetStylScrap ((hte (:handle :terec)))
  406.    (:stack (:handle :stscrprec))
  407.    (:stack-trap #xA83D hte (6 :signed-integer)))
  408.  
  409. (deftrap _GetStyleScrap ((hte (:handle :terec)))
  410.    (:stack (:handle :stscrprec))
  411.    (:stack-trap #xA83D hte (6 :signed-integer)))
  412.  
  413. (deftrap _TEStylInsert ((text :pointer) (length :signed-long) (hst (:handle :stscrprec)) (hte (:handle :terec)))
  414.    nil
  415.    (:stack-trap #xA83D text length hst hte (7 :signed-integer)))
  416.  
  417. (deftrap _TEStyleInsert ((text :pointer) (length :signed-long) (hst (:handle :stscrprec)) (hte (:handle :terec)))
  418.    nil
  419.    (:stack-trap #xA83D text length hst hte (7 :signed-integer)))
  420.  
  421. (deftrap _tegetheight ((endline :signed-long) (startline :signed-long) (hte (:handle :terec)))
  422.    (:stack :signed-long)
  423.    (:stack-trap #xA83D endline startline hte (9 :signed-integer)))
  424.  
  425. (deftrap _tecontinuousstyle ((mode (:pointer :signed-integer)) (astyle (:pointer :textstyle)) (hte (:handle :terec)))
  426.    (:stack :boolean)
  427.    (:stack-trap #xA83D mode astyle hte (10 :signed-integer)))
  428.  
  429. (deftrap _SetStylScrap ((rangestart :signed-long) (rangeend :signed-long) (newstyles (:handle :stscrprec)) (redraw :boolean) (hte (:handle :terec)))
  430.    nil
  431.    (:stack-trap #xA83D rangestart rangeend newstyles redraw hte (11 :signed-integer)))
  432.  
  433. (deftrap _SetStyleScrap ((rangestart :signed-long) (rangeend :signed-long) (newstyles (:handle :stscrprec)) (redraw :boolean) (hte (:handle :terec)))
  434.    nil
  435.    (:stack-trap #xA83D rangestart rangeend newstyles redraw hte (11 :signed-integer)))
  436.  
  437. (deftrap _TEUseStyleScrap ((rangestart :signed-long) (rangeend :signed-long) (newstyles (:handle :stscrprec)) (redraw :boolean) (hte (:handle :terec)))
  438.    nil
  439.    (:stack-trap #xA83D rangestart rangeend newstyles redraw hte (11 :signed-integer)))
  440.  
  441. (deftrap _tecustomhook ((which :signed-integer) (addr (:pointer :pointer)) (hte (:handle :terec)))
  442.    nil
  443.    (:stack-trap #xA83D which addr hte (12 :signed-integer)))
  444.  
  445. (deftrap _tenumstyles ((rangestart :signed-long) (rangeend :signed-long) (hte (:handle :terec)))
  446.    (:stack :signed-long)
  447.    (:stack-trap #xA83D rangestart rangeend hte (13 :signed-integer)))
  448.  
  449. (deftrap _tefeatureflag ((feature :signed-integer) (action :signed-integer) (hte (:handle :terec)))
  450.    (:stack :signed-integer)
  451.    (:stack-trap #xA83D feature action hte (14 :signed-integer)))
  452.  
  453. (deftrap _TEGetScrapLength nil
  454.    (:no-trap :signed-long)
  455.    (:no-trap (%get-unsigned-word (%int-to-ptr #xAB0))))
  456.  
  457. (deftrap _TEGetScrapLen nil
  458.    (:no-trap :signed-long)
  459.    (:no-trap (%get-unsigned-word (%int-to-ptr #xAB0))))
  460.  
  461. (deftrap _TESetScrapLength ((length :signed-long))
  462.    nil
  463.    (:no-trap (%put-word length (%int-to-ptr #xAB0))))
  464.  
  465. (deftrap _TESetScrapLength ((length :signed-long))
  466.    nil
  467.    (:no-trap (%put-word length (%int-to-ptr #xAB0))))
  468.  
  469. (deftrap _TEFromScrap nil
  470.   (:no-trap :OSErr)
  471.   (:no-trap (block exit
  472.               (rlet ((scrap-offset_p :long))
  473.                 (let ((scrap-size (#_GetScrap (%null-ptr) "TEXT" scrap-offset_p)))
  474.                   (when (minusp scrap-size)  (return-from exit scrap-size))
  475.                   (when (> scrap-size 32000) (return-from exit #$teScrapSizeErr))
  476.                   (with-macptrs ((TEScrap_h (%get-ptr (%int-to-ptr #$TEScrpHandle))))
  477.                     (let ((ecode (#_GetScrap TEScrap_h "TEXT" scrap-offset_p)))
  478.                       (when (minusp ecode)  (return-from exit ecode))
  479.                       (%put-word (%int-to-ptr #$TEScrpLength) scrap-size)
  480.                       #$noErr)))))))
  481.  
  482. (deftrap _TEToScrap nil
  483.   (:no-trap :OSErr)
  484.   (:no-trap (with-macptrs ((TEScrap_h (%get-ptr (%int-to-ptr #$TEScrpHandle))))
  485.               (with-dereferenced-handles ((TEScrap_p TEScrap_h))
  486.                 (#_PutScrap (%get-unsigned-word (%int-to-ptr #$TEScrpLength)) "TEXT" TEScrap_p)))))
  487.  
  488.  
  489. ; The "clikproc" should be defined with Assembler (vice Pascal) calling
  490. ; sequence.
  491. (deftrap _tesetclickloop ((clikproc :pointer) (hte (:handle :terec)))
  492.    nil
  493.    (:no-trap (setf (rref hte terec.clickloop) clickproc)))
  494.  
  495. (deftrap _SetClikLoop ((clikproc :pointer) (hte (:handle :terec)))
  496.    nil
  497.    (:no-trap (setf (rref hte terec.clickloop) clickproc)))
  498.  
  499. ; The "wbrkproc" should be defined with Assembler (vice Pascal) calling
  500. ; sequence.
  501. (deftrap _tesetwordbreak ((wbrkproc :pointer) (hte (:handle :terec)))
  502.    nil
  503.    (:no-trap (setf (ccl:rref hte terec.wordbreak) wbrkproc)))
  504.  
  505. (deftrap _SetWordBreak ((wbrkproc :pointer) (hte (:handle :terec)))
  506.    nil
  507.    (:no-trap (setf (ccl:rref hte terec.wordbreak) wbrkproc)))
  508.  
  509.  
  510. (export '($teJustLeft $teJustCenter $teJustRight $teForceLeft $teFlushDefault 
  511.           $teCenter $teFlushRight $teFlushLeft $fontBit $faceBit $sizeBit $clrBit 
  512.           $addSizeBit $toggleBit $toglBit $doFont $doFace $doSize $doColor $doAll 
  513.           $addSize $doToggle $EOLHook $DRAWHook $WIDTHHook $HITTESTHook $nWIDTHHook
  514.           $TextWidthHook $intEOLHook $intDrawHook $intWidthHook $intHitTestHook 
  515.           $intNWidthHook $intTextWidthHook $teFAutoScroll $teFAutoScr $teFTextBuffering
  516.           $teFOutlineHilite $teFInlineInput $teFUseTextServices $teBitClear $teBitSet $teBitTest
  517.           $teWordSelect $teWordDrag $teFromFind $teFromRecal $teFind $teHighlight $teDraw
  518.           $teCaret 
  519. ))
  520. (provide-interface 'TEXTEDIT)
  521.